import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)

const routes = [
  //路由表
  {
    path: '/login',
    name:'login',
   
    component: () => import('../views/login/Login.vue'), //懒加载
  },
  {
    path: '/marger',
    name:"marger",
   
    component: () => import('../views/marger/Index.vue'),
    children:[  //子路由
      {
        path:'/marger/margerclass',
        name:'margerclass',
        meta:{  //路由源信息
          label:'班级'
        },
        component:()=>import('../views/marger/MargerClass.vue')
      },
      {
        path:'/marger/stumarger',
        name:'stumarger',
        meta:{  //路由源信息
          label:'学生'
        },
        component:()=>import('../views/marger/StuMarger.vue')
      },

    ]
  },
  {
    path: '/registry',
    name:'registry',
  
    component: () => import('../views/registry/Registry.vue'),
  },
  //路由重定向
  {
    path:'/',
    rediret:'/marger'
  }

  // {
  //   path: '/',
  //   name: 'home',
  //   component: HomeView
  // },
  // {
  //   path: '/about',
  //   name: 'about',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  // }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
